home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hráč 2004 August
/
Hrac_72_2004-08_dvd.iso
/
dema
/
Rapid Gun
/
rg_setup.exe
/
common
/
image_GaussianBlur.fx
< prev
next >
Wrap
Text File
|
2004-04-19
|
2KB
|
59 lines
// LF2 Engine
// (C) 2002-3 7FX
//---------------------------------------------------------------------------
// Desc
string desc : Description = "Image shader - 3x3 gaussian blur.";
// Shader type phase
string type : Type = "image";
//---------------------------------------------------------------------------
// Constants
const float4 cLum = {0.3f, 0.59f, 0.11f, 1.f};
const float2 sampleOffsets[8] : SampleOffsets;
// Render target texture
texture RT : RenderTargetFSMap;
//---------------------------------------------------------------------------
sampler sRT = sampler_state
{
Texture = <RT>;
MinFilter = POINT;
MagFilter = POINT;
AddressU = CLAMP;
AddressV = CLAMP;
};
//---------------------------------------------------------------------------
// Pixel shader
float4 PS(float2 uv: TEXCOORD0) : COLOR
{
int i =0;
float4 c = .5;
float2 texCoords;
float4 texSamples[8];
float4 total=0;
float multipliers[8]= {1,2,1,
2, 2,
1,2,1};
for(i =0; i<8; i++)
{
texCoords = uv + sampleOffsets[i]; // add sample offsets
// take sample, mul by by kernel
total += tex2D(sRT, texCoords) * multipliers[i];
}
total += 4 * tex2D(sRT, uv);
c = total/16.0;
return c;
}
//---------------------------------------------------------------------------
technique vs0_ps20
{
pass p0
{
ZEnable = false;
ZWriteEnable = false;
PixelShader = compile ps_2_0 PS();
}
}
//---------------------------------------------------------------------------